//
//  BindFootView.swift
//  MoyoungDevice
//
//  Created by 易先生 on 2022/9/9.
//

import UIKit
import MYModule

class BindFootView: View {

	override init(frame: CGRect) {
		super.init(frame: frame)
	}

	required init?(coder: NSCoder) {
		fatalError("init(coder:) has not been implemented")
	}

	override func makeUI() {
		super.makeUI()
		self.addSubview(hitLabel)
		self.addSubview(activityIndicatorView)
		hitLabel.snp.makeConstraints { make in
			make.center.equalToSuperview()
		}

		activityIndicatorView.snp.makeConstraints { make in
			make.trailing.equalTo(hitLabel.snp.leading).offset(-5)
			make.size.equalTo(CGSize(width: 15, height: 15))
			make.centerY.equalToSuperview()
		}
	}

	public func startAnimating() {
		activityIndicatorView.startAnimating()
	}

	public func stopAnimating() {
		activityIndicatorView.stopAnimating()
	}

	public func configHit(hit: String) {
		hitLabel.text = hit
	}
    
    
    //MARK: - lazy load -

	private lazy var hitLabel: Label = {
		let hitLabel = Label()
		hitLabel.font = Fonts.systemFont(ofSize: 12)
        hitLabel.textColor = UIColor.assist_D0D0D0
		return hitLabel
	}()

	private lazy var activityIndicatorView: UIActivityIndicatorView = {
		let activityIndicatorView = UIActivityIndicatorView(style: .white)
		activityIndicatorView.color = UIColor.assist_D0D0D0
		return activityIndicatorView
	}()
    
}
